using UnityEngine;
using System.Collections;

public class CameraMover : MonoBehaviour 
{
	public Transform reference;
	
	private float thisZ;
	private Transform thisTransform;
	
	public void Start () 
	{
		thisTransform = transform;
		thisZ = thisTransform.position.z;
	}
	
	public void FixedUpdate ()
	{
		Vector3 moveTo = new Vector3 (reference.position.x, reference.position.y, thisZ);
		thisTransform.position = Vector3.MoveTowards (thisTransform.position, moveTo, 50f * Time.deltaTime);
	}
}